package org.dromara.iot.enums;

import lombok.Getter;

/**
 * 电梯事件类型枚举
 */
@Getter
public enum DeviceElevatorEventTypeEnum {
    TIMED_REPORT(0, "定时上报"),
    EXTERNAL_TRIGGER(1, "一键报警"),
    ELECTRIC_VEHICLE_TRIGGER(2, "电瓶车触发事件"),
    OFFLINE_ONLINE_EVENT(3, "上下线事件"),
    DOOR_CLOSE(4, "关门事件"),
    ELEVATOR_TRAPPED(8, "梯困事件"),
    LONG_TIME_OPEN(16, "长时间开门事件"),
    DOOR_OPEN(32, "开门事件"),
    OVERLOAD(64, "人员超载事件"),
    LENS_COVERED(128, "镜头遮挡事件"),
    MANUAL_TRIGGER(256, "手动触发事件"),
    REMOTE_MANUAL_CAPTURE(512, "远程手动抓拍事件"),
    ELECTRIC_VEHICLE_LEAVE(1024, "电瓶车离开事件"),
    ABNORMAL_SOUND(2048, "异常声音（呼救）"),
    ELEVATOR_SHAKE(4096, "电梯抖动（电梯打闹）"),
    OVERSPEED(8192, "超速事件"),
    FLOOR_ARRIVAL(16384, "楼层到达"),
    TOP_COLLISION(32768, "冲顶事件"),
    BOTTOM_COLLISION(65536, "蹲底事件"),
    DOOR_OPEN_RUN(131072, "开门走梯事件"),
    REPEATED_DOOR_OPEN_CLOSE(262144, "反复开关门"),
    HIGH_FREQUENCY_RUN(524288, "无人高频运行"),
    DAMAGE_ELEVATOR(1048576, "破坏电梯"),
    ELEVATOR_FALL(2097152, "坠梯"),
    EMERGENCY_STOP(4194304, "急停"),
    FLOOR_CHANGE(8388608, "楼层变化"),
    NON_LEVEL_STOP(16777216, "非平层停梯"),
    GAS_CYLINDER(33554432, "煤气罐事件"),
    POWER_FAILURE(67108864, "断电告警"),
    BATTERY_TRIGGER(134217728, "电池触发事件");

    private final int code;
    private final String description;

    DeviceElevatorEventTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    public static DeviceElevatorEventTypeEnum getByCode(int code) {
        for (DeviceElevatorEventTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }
}